<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var o = [12,4,55,64,7,59,10,15];

    function arrayMax(p){
        var max = p[0];
        for(var i = 1, ilen = p.length; i < ilen; i+=1) {
            if(p[i] > max) {
                max = p[i];
            }
        }
        return max;
    }
    console.log(arrayMax(o));

    function arrayMin(p){
        var min = p[0];
        for(var i = 1, ilen = p.length; i < ilen; i+=1) {
            if(p[i] < min) {
                min = p[i];
            }
        }
        return min;
    }
    console.log(arrayMin(o));
</script>
</body>
</html>